package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.anno.AutoFill;
import com.sky.dto.DishDTO;
import com.sky.dto.DishPageQueryDTO;
import com.sky.entity.Dish;
import com.sky.enumeration.OperationType;
import com.sky.vo.DishVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface DishMapper {
    @Select("select count(*) from dish where  category_id = #{categoryId}")
    Integer countByCategoryId(Integer id);

    /**
     * 分页查询菜品
     *
     * @param dto
     * @return
     */
    Page<DishVO> dishPageQuery(DishPageQueryDTO dto);

    @AutoFill(OperationType.INSERT)
    void saveDish(Dish dish);


    @Select("select * from dish where id = #{id}")
    Dish getById(Long id);


    void deleteDish(List<Long> ids);

    Dish getDishById(Integer id);

    @AutoFill(OperationType.UPDATE)
    void updataDish(Dish dis);

//    @Update("update dish set status = #{status} where id = #{id}")
//    @AutoFill(OperationType.UPDATE)
//    void status(Integer status, Integer id);
}
